def inp():
    s = input()
    ss = s[1:len(s)-1]
    sss = ss.split(',')
#    print(sss)
    return sss

def strint(sss):
    for i in range(0,len(sss)):
        sss[i] = int(sss[i])

def calc(m):
#    print(m,m%2)
    return m//2,m%2

def two(m):
    ans1,ans2 = calc(m)
    l = []
    while True:
        if ans1 == 0 and ans2 == 0:
            break
        l.append(ans2)
        ans1,ans2 = calc(ans1)
    l.reverse()
    return l

def one(l):
    s = 0
    for i in l:
        if i == 1:
            s += 1
    return s

def do(a):
    return one(two(a))
            
def search(start):
    i = start
    aim = do(start)
    while True:
        i += 1
        ans = do(i)
        if ans == aim:
            return i

def main():
    ans = []
    sss = inp()
    strint(sss)
    for i in sss:    
        ans.append(search(i))
    print(ans)
    
main()
